﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using YTCMS.Core;
using YTCMS.Services.Services;

namespace App.Controllers
{
    /// <summary>
    /// 自由行
    /// </summary>
    public class FreeController : Controller
    {
        //
        // GET: /Free/
        private readonly IproductsService _product;
        private readonly ImoduleService _module;
        private readonly IcmscolumnService _cmscolumn;
        private readonly IcolumnproductService _columnproducts;

        public FreeController(IproductsService product, IcmscolumnService cmscolumn, IcolumnproductService columnproducts, ImoduleService module)
        {
            this._product = product;
            this._cmscolumn = cmscolumn;
            this._columnproducts = columnproducts;
            this._module = module;
        }
        //
        // GET: /XZTour/
        public ActionResult Index()
        {
            var code = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();
            var columns = _cmscolumn.GetMany(s => s.State == (int)CommonState.正常 && s.module.Code.Equals(code), Order.desc, "Sort");
            return View(columns);
        }
	}
}